package com.zhentao.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhentao.pojo.UserFeedback;
import com.zhentao.service.UserFeedbackService;
import com.zhentao.vo.Query;
import com.zhentao.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/UserFeedback")
public class UserFeedbackController {
    @Autowired
    private UserFeedbackService userFeedbackService;

    @RequestMapping("/findPage")
    public Result findPage(@RequestBody Query query){
        Page<UserFeedback> page = userFeedbackService.findPage(query);
        return Result.OK(page);
    }

    //删除
    @RequestMapping("/delete")
    public String delete(Integer id){
        boolean delete = userFeedbackService.removeById(id);
        return delete?"删除成功":"删除失败";
    }

    //修改
    @RequestMapping("/update")
    public String update(@RequestBody UserFeedback userFeedback){
        boolean update = userFeedbackService.updateById(userFeedback);
        return update?"修改成功":"修改失败";
    }
}
